﻿<UserControl x:Class="Sautom.Modules.Client.Views.ContractView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:res="clr-namespace:Sautom.I18N;assembly=Sautom.I18N" xmlns:l="clr-namespace:Sautom.ClientComunication.Converters;assembly=Sautom.ClientComunication"
             xmlns:System="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <l:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
        <l:BoolToVisibilityInversedConverter x:Key="BoolToVisibilityInversedConverter" />

        <Style TargetType="Border">
            <Setter Property="BorderBrush" Value="Azure" />
            <Setter Property="BorderThickness" Value="3" />
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="Salmon" />
            <Setter Property="Text" Value="{Binding Path=EndDateTime, StringFormat=d}" />
            <Style.Triggers>
                <!--<DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Self}}"  Value="{x:Static System:DateTime.MinValue}">
                    <Setter Property="Text" Value="" />
                </DataTrigger>-->
                <DataTrigger Binding="{Binding Text, ElementName=aaa}"  Value="{x:Static System:DateTime.MinValue}">
                    <Setter Property="Text" Value="" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200*" />
            <ColumnDefinition Width="200*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="250*" />
        </Grid.RowDefinitions>
        <Menu Grid.ColumnSpan="2">
            <MenuItem Header="{Binding Source={x:Static res:ClientResources.EditOrCreateBtn}}" Command="{Binding EditCommand}" />
            <MenuItem Header="{Binding Source={x:Static res:ClientResources.BackToClientDetailsBtn}}" Command="{Binding BackCommand}" />
            <MenuItem Header="{Binding Source={x:Static res:ClientResources.PrintConsultingBtn}}" Command="{Binding PrintConsultingCommand}" CommandParameter="ConsultingInfo" />
            <MenuItem Header="{Binding Source={x:Static res:ClientResources.PrintWorkshopBtn}}" Command="{Binding PrintConsultingCommand}" CommandParameter="WorkshopInfo" />
        </Menu>
        <StackPanel Grid.Row="1" Visibility="{Binding IsShowContract, Converter={StaticResource BoolToVisibilityConverter}}">
            <Border>
                <StackPanel>
                    <Label Content="{Binding Source={x:Static res:ClientResources.ConsultingNumberLabel}}" />
                    <TextBlock Text="{Binding ConsultingNumber}" />
                    
                    <Label Content="{Binding Source={x:Static res:ClientResources.ConsultingDateLabel}}" />
                    <TextBlock Text="{Binding ConsultingDate, StringFormat=d}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.ConsultingHoursLabel}}" />
                    <TextBlock Text="{Binding ConsultingHours}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.ConsultingSumLabel}}" />
                    <TextBlock Text="{Binding ConsultingSum}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.ConsultingActDateLabel}}" />
                    <TextBlock x:Name="aaa" Text="{Binding ConsultingActDate, StringFormat=d}" />
                </StackPanel>
            </Border>
            <Border>
                <StackPanel>
                    <Label Content="{Binding Source={x:Static res:ClientResources.WorkshopNumberLabel}}" />
                    <TextBlock Text="{Binding WorkshopNumber}" />
                    
                    <Label Content="{Binding Source={x:Static res:ClientResources.WorkshopDateLabel}}" />
                    <TextBlock Text="{Binding WorkshopDate, StringFormat=d}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.WorkshopHoursLabel}}" />
                    <TextBlock Text="{Binding WorkshopHours}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.WorkshopSumLabel}}" />
                    <TextBlock Text="{Binding WorkshopSum}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.WorkshopActDateLabel}}" />
                    <TextBlock Text="{Binding WorkshopActDate, StringFormat=d}" />
                </StackPanel>
            </Border>
            <Border>
                <StackPanel>
                    <Label Content="{Binding Source={x:Static res:ClientResources.InvoiceDateLabel}}" />
                    <TextBlock Text="{Binding InvoiceDate, StringFormat=d}" />
                    <Label Content="{Binding Source={x:Static res:ClientResources.InvoiceSumLabel}}" />
                    <TextBlock Text="{Binding InvoiceSum}" />
                </StackPanel>
            </Border>
        </StackPanel>
        <Label Grid.Row="1" Visibility="{Binding IsShowContract, Converter={StaticResource BoolToVisibilityInversedConverter}}" 
                   Content="{Binding Source={x:Static res:ClientResources.ContractDoesNotFilledLabel}}" />
    </Grid>
</UserControl>
